#pragma once

#include "Poller.h"

class EPollPoller : public Poller 
{
    public:
    EPollPoller(EventLoop* loop);
    ~EPollPoller() override;

    Timestamp poll(int timeousMs,ChannelList* activeChannels) override;
    void updateChannel(Channel* channel) override;
    void removeChannel(Channel* channel) override;

    private:

    static const int KintEventListSize = 16;

    // 填写活跃的连接
    void fillActiveChannel(int numEvents,ChannelList* activeChannels) const;

    // 更新新的通道
    void update(int operation,Channel* channel);

    using EventList = std::vector<struct epoll_event>;
    int epollfd_;
    // 用于存储epoll_fd返回的事件列表
    EventList events_;

};